/*
 * Stopwatch.cpp
 *
 *  Created on: Nov 29, 2010
 *      Author: timmeh
 */

#include "Stopwatch.h"

/**
 * Constructor initializes the Frames per second
 */
Stopwatch::Stopwatch(int fps) : fFPS(fps), fPrevTime(clock()){

}

Stopwatch::~Stopwatch() {

}

/**
 * Waits till the appropriate time length has been passed, then returns
 */
void Stopwatch::GetTick(){
	clock_t endTime = fPrevTime + (1.0/this->fFPS)*CLOCKS_PER_SEC;
	while (clock() < endTime){}
	fPrevTime = clock();
	return;
}
